﻿@model ThaireInvestmentWeb.Models.EditDepositGuaranteeTransactionModel
@{
    ViewBag.Title = "Edit Deposit Transaction";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script>
    $(document).ready(function () {

        $("#SettlementDate,#Transaction_GuaranteeStartDate,#Transaction_GuaranteeEndDate").datepicker(
            {
                dateFormat: 'dd/mm/yy',
                showOn: 'button',
                showAnim: 'fadeIn',
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                buttonImage: '@Url.Content("~/Content/images/Calendar.png")'
            });

        $("#CancelBtn").click(function (event) {
            //showConfirm("Are you sure to cancel ?", CancelBtnAction);
            showConfirm(null, CancelBtnAction);
            return false;
        });
    });

    function CancelBtnAction(event) {
        window.location.href = 'EditDepositHeader?headerId=@Model.HeaderID';
    }
</script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<table class="navi" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td style="width: 100%;">
            <div class="navi">
                Instrument Type > <a href="@Url.Action("ManageDeposit", "Deposit", new { headerId = Model.Header.DepositHeaderID })">Deposit at Financial Institutions</a> > <a href="@Url.Action("EditDepositHeader", "Deposit", new { headerId = Model.Header.DepositHeaderID })">Header</a> > GUARANTEE
            </div>
        </td>
    </tr>
</table>
<table class="tableheader" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td height="38" align="center" style="width: 100%; text-align: center;">INPUT Guarantee : Deposit at Financial Institutions</td>
    </tr>
</table>

<table width="100%" border="0" align="center">
    <tr>
        <td>
            @Html.Partial("_DepositHeaderView", Model.HeaderDTO)
            @Html.ValidationSummary(true)
            @using (Html.BeginForm("EditDepositGuaranteeTransaction", "Deposit", FormMethod.Post, new { id = "mainForm" }))
            {
                <table style="margin-top: 20px;" class="tableform" width="100%" border="5" align="center" cellspacing="2">
                    <tr>
                        <td style="height: 4px">&nbsp;</td>
                        <td style="height: 4px"></td>
                        <td style="width: 236px; height: 4px;"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">ประเภทธุรกรรม : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.TextBoxFor(model => model.TransactionType, new { @readonly = "readonly", @Value = Model.TransactionType })
                            @Html.ValidationMessageFor(model => model.TransactionType)</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">Ref. No.<span class="error"> * </span>: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.EditorFor(model => model.RefNo)
                            @Html.ValidationMessageFor(model => model.RefNo)</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">ภาระผูกพัน : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            @Html.DropDownListFor(x => x.SelectedObligationID, Model.ObligationList)
                            @Html.ValidationMessageFor(model => model.SelectedObligationID)</td>
                        <td>
                            <div align="right">ประเภทหลักประกัน : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.EditorFor(model => model.GuaranteeType)
                            @Html.ValidationMessageFor(model => model.GuaranteeType)</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">สินทรัพย์จัดสรรตามมาตรา : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            @Html.DropDownListFor(x => x.SelectedObligationNOID, Model.ObligationNOList)
                            @Html.ValidationMessageFor(model => model.SelectedObligationNOID)</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">Settlement Date<span class="error"> * </span>: </div>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            @Html.TextBoxFor(model => model.SettlementDate, new { @readonly = "readonly", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.SettlementDate) })
                            @Html.ValidationMessageFor(model => model.SettlementDate)</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">มูลค่า : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 236px">
                            @Html.EditorFor(model => model.Amount)
                            @Html.ValidationMessageFor(model => model.Amount)</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            <div align="right">วันที่เริ่มต้น : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 120px">
                            @Html.TextBoxFor(model => model.Transaction.GuaranteeStartDate, new { @readonly = "readonly", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.Transaction.GuaranteeStartDate) })
                            @Html.ValidationMessageFor(model => model.Transaction.GuaranteeStartDate)
                        </td>
                        <td>
                            <div align="right">วันที่สิ้นสุด : </div>
                        </td>
                        <td>&nbsp;</td>
                        <td style="width: 120px">
                            @Html.TextBoxFor(model => model.Transaction.GuaranteeEndDate, new { @readonly = "readonly", @Value = ThaireInvestmentWeb.Util.WebUtil.FormatDate(@Model.Transaction.GuaranteeEndDate) })
                            @Html.ValidationMessageFor(model => model.Transaction.GuaranteeEndDate)
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 4px">&nbsp;</td>
                        <td style="height: 4px"></td>
                        <td style="width: 236px; height: 4px;"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                        <td style="height: 4px"></td>
                    </tr>
                </table>
    
                <table width="95%" height="85" border="0" align="center">
                    <tr>
                        <td>
                            <div align="center">

                                <input id="SubmitBtn" type="submit" name="SubmitBtn" value=" Submit " class="button" need-confirm="true" />
                                &nbsp;&nbsp; 
                            <input id="CancelBtn" type="button" name="CancelBtn" value=" Cancel " class="button" />
                            </div>
                        </td>
                    </tr>

                </table>
    
                @Html.HiddenFor(x => x.UpdateMode);
                @Html.HiddenFor(x => x.HeaderID);
                @Html.HiddenFor(x => x.TransactionID);

            }

        </td>
    </tr>
</table>
